import { IFilm, IFilmDetail, IFilmResponse } from '../type/film';
import { IParams } from '../type/public';
import { Http } from './http.init';

export class GatewayService {
  /**
   * 获取电影列表
   * @param data
   * @returns
   */
  static async getFilmList(data: Partial<IParams>) {
    try {
      return await Http.get<IFilmResponse>('/gateway', data, {
        host: ' mall.film-ticket.film.list'
      })
    } catch (e) {
      console.error(e)
    }
  }

  /**
   * 获取电影详情
   * @param data
   * @returns
   */
  static async getFilmDetail(data: Partial<IFilmDetail>) {
    try {
      return await Http.get<{ film: IFilm }>('/gateway', data, {
        host: ' mall.film-ticket.film.info'
      })
    } catch (e) {
      console.error(e)
    }
  }
}